#ifndef __CLIENT_SERVICE_REQUESTER__
#define __CLIENT_SERVICE_REQUESTER__


#include <cassert>
#include <string>

#include "Msg\hzCommander.h"
#include "..\Common\CommonObject.h"
#include "..\Common\CommonMessage.h"

#include "ClientBase.h"


class network;
class object_manager;

// user order message's string. 
const wchar_t ORDER_STRING_CLIENTS[]						= _T("/clients");
const wchar_t ORDER_STRING_MY_CLIENTCODE[]					= _T("/mycode");
const wchar_t ORDER_STRING_TOGGLE_MY_SEND_COUNT[]			= _T("/sendcount");
const wchar_t ORDER_STRING_TOGGLE_RECV_COUNT[]				= _T("/recvcount");
const wchar_t ORDER_STRING_TOGGLE_EFFECTIVE_RECV_COUNT[]	= _T("/effectiverecv");
const wchar_t ORDER_STRING_TOGGLE_POSITION_INTERPOLATION[]	= _T("/posinterpolation");
const wchar_t ORDER_STRING_CLEAR_COMMANDER[]				= _T("/clear");
const wchar_t ORDER_STRING_MONITER_BROADCAST[]				= _T("/moniterbroadcast");
const wchar_t ORDER_STRING_FRAME30[]						= _T("/frame30");
const wchar_t ORDER_STRING_FRAME15[]						= _T("/frame15");
const wchar_t ORDER_STRING_FRAME10[]						= _T("/frame10");
const wchar_t ORDER_STRING_FRAME3[]							= _T("/frame3");
const wchar_t ORDER_STRING_UDP_LINK_COUNT[]					= _T("/udplinkcount");



class service_requester {
private:
	client_base*		m_pClient;
	object_manager*		m_pObjectManager;
	network*			m_ServiceNetwork;
	hz::commander*		m_pCommander;
	CRITICAL_SECTION	m_CriticalSection;	
	
public:
	service_requester(void);
	~service_requester(void);

	void LinkClient(client_base* pClient);
	void LinkObjectManager(object_manager* pObjectManager);
	void LinkCommander(hz::commander* pCommander);

	void SetServiceNetwork(network*	ServiceNetwork);

	bool RequestByString(wstring String);	
	bool RequestByCode(SERVICE_MESSAGE RequestCode);

	// Request Methods.
	bool RequestREQUEST_CODE(void);
	bool RequestREQUEST_CLIENT(void);
	bool RequestREQUEST_OBJECT(void);
	bool RequestREQUEST_RELAY_LINK(void);
	bool RequestNOTICE_NEW_OBJECT(OBJECT_TYPE ObjectType, int ExtraLength, char* Extra);		
	bool RequestNOTICE_DEL_OBJECT(unsigned int ObjectID);
	bool RequestNOTICE_ACCESS_OFF(void);
	bool RequestNOTICE_MISSILE_CRUSH(unsigned int MissileID, unsigned int TargetID);
	bool RequestNOTICE_MESSAGE(wstring Stirng);
};

#endif